<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>

<div class="easyui-layout" fit="true">
  <div region="center" style="padding:1px;">
  <t:datagrid name="contractList" title="销售合同" actionUrl="saleContractCheckController.do?datagrid"  idField="id" fit="true" queryMode="group" onLoadSuccess="merge" pagination="false">
   <t:dgCol title="编号" field="id" hidden="false" ></t:dgCol>
   <t:dgCol title="申请单号" field="FContractID" hidden="false"></t:dgCol>
  
   <t:dgCol title="合同号" field="FContractNo" ></t:dgCol>
   <t:dgCol title="客户" field="FCustomer_DSPName" ></t:dgCol>
   <t:dgCol title="付款期限" field="FText2"></t:dgCol>
   
   <t:dgCol title="金额" field="FTotalAmount"></t:dgCol>
    <t:dgCol title="申请人" field="FBillerID_DSPName" > </t:dgCol>
    <t:dgCol title="结算方式" field="FBase1_DSPName" ></t:dgCol>
   <t:dgCol title="签订日期" field="FReceiveDate" formatter="yyyy-MM-dd" ></t:dgCol>
   
   <t:dgCol title="产品名称" field="FItemID40828_DSPName"></t:dgCol>
   <t:dgCol title="厚度" field="FItemID40891_DSPName"></t:dgCol>
   <t:dgCol title="宽度" field="FText6"></t:dgCol>
   <t:dgCol title="交货状态" field="FBase4_DSPName"></t:dgCol>
   <t:dgCol title="交货日期" field="FDate1" formatter="yyyy-MM-dd"></t:dgCol>
   <t:dgCol title="数量" field="FQuantity"></t:dgCol>
   <t:dgCol title="含税单价" field="FTaxPriceFor"></t:dgCol>
   <t:dgCol title="价税合计" field="FAmountIncludeTaxFor"></t:dgCol>
   
   <t:dgToolBar title="审批" icon="icon-ok" url="saleContractCheckController.do?check" funname="contract_check"></t:dgToolBar>
   <t:dgToolBar title="驳回" icon="icon-redo" url="saleContractCheckController.do?uncheck" funname="contract_uncheck"></t:dgToolBar>
   <t:dgToolBar title="查看" icon="icon-search" url="saleContractCheckController.do?addorupdate" funname="check_detail"></t:dgToolBar>
  </t:datagrid>
  </div>
</div>
 
  <script>
 	function contract_check(title,url, id,width,height) {
		
		var rowsData = $('#'+id).datagrid('getSelections');
		if (!rowsData || rowsData.length==0) {
			tip('请选择一条记录');
			return;
		}
		if (rowsData.length>1) {
			tip('请选择一条记录');
			return;
		}
		url += '&id='+rowsData[0].FContractID + '&no='+rowsData[0].FContractNo;
		createwindow(title,url,width,height);
	}
	
	 	function contract_uncheck(title,url, id,width,height) {
		
		var rowsData = $('#'+id).datagrid('getSelections');
		if (!rowsData || rowsData.length==0) {
			tip('请选择一条记录');
			return;
		}
		if (rowsData.length>1) {
			tip('请选择一条记录');
			return;
		}
		url += '&id='+rowsData[0].FContractID + '&no='+rowsData[0].FContractNo;
		createwindow(title,url,width,height);
	}
	
/**
 * 合并主表列表单元格
 * @param indexs
 */
function merge() { 
	
	MergeCells('contractList','FContractNo,FCustomer_DSPName,FText2,FTotalAmount');
		
};

</script>